import java.util.ArrayList;


public class MKDIR extends Command {

	public MKDIR(ArrayList<String> args) {
		super(args);
	}

	public void execute() {
		for (int i =1; i < arguments.size() ; i++){
			try{
			String dirname = mocksystem.getItemName(arguments.get(i)); // write that method
			Directory dirparent = (Directory) mocksystem.getItemParent(arguments.get(i));  // write this method too
			// above line MAY cause problems. what if u use "/user/file/dir"? where dir is what you want to make?
			Directory newDir = new Directory(dirname, dirparent);
			dirparent.addItem(newDir);	// must go in try/catch block
			}catch (InvalidPathException e){
				System.out.println(e);
			}catch (DuplicateItemException e){
				System.out.println(e);
			}catch (ClassCastException e){
				System.err.println("Invalid path.");
			}
		}
	}
}
